﻿Public Class frmLoginForm
    'Private strUserLoginName As ClsSQLhelper

    ' TODO: Insert code to perform custom authentication using the provided username and password 
    ' (See http://go.microsoft.com/fwlink/?LinkId=35339).  
    ' The custom principal can then be attached to the current thread's principal as follows: 
    '     My.User.CurrentPrincipal = CustomPrincipal
    ' where CustomPrincipal is the IPrincipal implementation used to perform authentication. 
    ' Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object
    ' such as the username, display name, etc.

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        If UsernameTextBox.Text <> "" And PasswordTextBox.Text <> "" Then
            If UsernameTextBox.Text = "admin" And PasswordTextBox.Text = "akissoft" Then
                frmMain.ToolStripStatusLabel2.Text = frmMain.ToolStripStatusLabel2.Text & UsernameTextBox.Text
                frmMain.ToolStripStatusLabel3.Text = " | " & String.Format("Version {0}", My.Application.Info.Version.ToString)
                frmMain.Text = frmMain.Text & "   User : " & UsernameTextBox.Text & "   " & String.Format("Version {0}", My.Application.Info.Version.ToString)

                frmMain.Show()
                Me.Hide()

            Else

                MsgBox("Username หรือ Password ไม่ถูกต้อง ", MsgBoxStyle.Exclamation, "ข้อมูลไม่ถูกต้อง")

            End If

        Else

            MsgBox("กรุณากรอก Username หรือ Password ", MsgBoxStyle.Exclamation, "ข้อมูลไม่ถูกต้อง")

        End If
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        Me.Close()
    End Sub

    Private Sub UsernameTextBox_TextChanged(sender As System.Object, e As System.EventArgs) Handles UsernameTextBox.TextChanged

    End Sub

    Private Sub frmLoginForm_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        lblVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
    End Sub
End Class
